package xGRUx.MCdirGlztab;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class UITabAct extends TabActivity
{ 
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	    setContentView(R.layout.main);
	    
		createTabs();
		//setupTabs();
	}
	
	public void createTabs() {
		Resources res = getResources(); // Resource object to get Drawables
	    TabHost tabHost = getTabHost();  // The activity TabHost
	    TabHost.TabSpec spec;  // Reusable TabSpec for each tab
	    Intent intent;  // Reusable Intent for each tab
	    
	    
	    // Home's tab
	    intent = new Intent().setClass(this, StoryAct.class);
	    spec = tabHost.newTabSpec("home").setIndicator("",
	                      res.getDrawable(R.drawable.ic_tab_home))
	                  .setContent(intent);
	    tabHost.addTab(spec);
	    
	    // Play's tab
	    intent = new Intent().setClass(this, PlayAct.class);
	    spec = tabHost.newTabSpec("play").setIndicator("",
	                      res.getDrawable(R.drawable.ic_tab_play))
	                  .setContent(intent);
	    tabHost.addTab(spec);
	    
	    // Setting's tab
	    intent = new Intent().setClass(this, SettingAct.class);
	    spec = tabHost.newTabSpec("setting").setIndicator("",
	                      res.getDrawable(R.drawable.ic_tab_settng))
	                  .setContent(intent);
	    tabHost.addTab(spec);
	    
	    // Exit's tab
	    intent = new Intent().setClass(this, StoryAct.class);
	    spec = tabHost.newTabSpec("exit").setIndicator("",
	                      res.getDrawable(R.drawable.ic_tab_exit))
	                  .setContent(intent);
	    tabHost.addTab(spec);
	}
	/*
	public void setupTabs() {
		RadioButton rbHome = (RadioButton) findViewById(R.id.rbHome);
	    RadioButton rbPlay = (RadioButton) findViewById(R.id.rbPlay);
	    RadioButton rbSet = (RadioButton) findViewById(R.id.rbSet);
	    RadioButton rbExit = (RadioButton) findViewById(R.id.rbExit);
	    
	    rbHome.setButtonDrawable(R.drawable.tab_home);
	    rbPlay.setButtonDrawable(R.drawable.tab_play);
	    rbSet.setButtonDrawable(R.drawable.tab_set);
	    rbExit.setButtonDrawable(R.drawable.tab_quit);
	    
	    RadioGroup rg = (RadioGroup) findViewById(R.id.states);
	    
	    rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
	        public void onCheckedChanged(RadioGroup group, final int checkedId) {
	            switch (checkedId) {
	            case R.id.rbHome:
	            	getTabHost().setCurrentTab(0);
	                break;
	            case R.id.rbPlay:
	            	getTabHost().setCurrentTab(1);
	                break;
	            case R.id.rbSet:
	            	getTabHost().setCurrentTab(2);
	                break;
	            case R.id.rbExit:
	            	getTabHost().setCurrentTab(3);
	                break;
	            }
	        }
	    });
	}*/
}
